<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<title>显示机会</title>
	<style type="text/css">
		body{
			background-color:#F3F1EC;
			margin-top:70px;
		}
		
	</style>
</head>
<body>
	<%@ include file="include/base.jsp" %>
	<%@ include file="include/base-after.jsp" %>
		<!--content-->
		<div id="aaa">
			<div class="container-fluid" style="margin-top:60px;">
				<div class="row-fluid">
					<div class="span8" >
						<div class="well" style="box-shadow:0 0 3px #CCCCCC;background-color:#F0F5F8;">
								<div class="jihui">
									<p class="pull-right">
										<button id="export" class="btn czx">
											<i class="icon-share-alt icon-black"></i><a href="chance.jspx">导出为EXCEL</a>
										</button>											
									</p>
									
									<p style="font-size:18px;" id="suoyou">业务机会→最近一周
									</p>
									<p style="colcor:#blue">${chanceList.size()}个机会,价值￥
										<script type="text/javascript">
											var total=0;
											<c:forEach items = "${chanceList}" var = "c">
												total=total + ${c.money};
											</c:forEach>
											document.write(total);
										</script>
									</p>	
								</div>	
						</div>
						<div style="box-shadow:0 0 3px #CCCCCC;background-color:#fff;margin-top:-20px;">
									<div style="padding:20px">
										<p style="font-weight:bold;font-size:18px;"><a href="createchance.jspx">${ch.chancename}</a></p>
								</div>
							</div>	
							
							<c:forEach items="${chanceList}" var="chance">
									<p class="pull-right">
										<span class="badge" id="span">${chance.createtime} 
											<c:if test="${'success' eq chance.state}">成功</c:if>
											<c:if test="${'pading'  eq chance.state}">跟踪</c:if>
											<c:if test="${'lost' eq chance.state}">失败</c:if>
										</span>
									</p>
									<p>来自<a href="">${contact.contactname}</a></p>
									<p><span class="badge">${chance.chancename}</span>&nbsp;￥${chance.money} </p>
									<p>由&nbsp;&nbsp;${employee.name}&nbsp;&nbsp;负责</p>
									
								</c:forEach>
							<!--<c:if test="${'10' eq ch.id}"></c:if>	
						-->
					</div>
					<div class="span4">
						<div style="background-color:#fff;border-radius:5px;padding:20px;font-size:18px;box-shadow:4px 5px 5px #252525;">
								<p><a href="addchance.jspx">创建机会</a></p>
						</div>
						<div style="margin-top:20px;background-color:#fff;padding:15px;box-shadow:2px 3px 4px #757575">
							<p style="font-weight:bold;font-size:18px;">过滤条件... <span class="pull-right" style="font-size:12px"><a href="chance.jspx">清除过滤条件</a></span></p>
							<hr />
								<div>
									<div class="controls">
									 	<label>状态</label>
		              					<select id="select01" name="peid" class="span2">
		                  					<option value="suo">所有状态</option>
		                  					<option value="won">成功</option>
		                  					<option value="lost">失败</option>
		                  					<option value="pending">跟踪</option>
		                  				</select>
	              					</div>
									<div class="controls">
									 	<label>分类</label>
		              					<select id="select02" name="peid" class="span2">
		                  					<c:forEach items="${chanceItemList}" var="ce" >
		                  						<option  value="${ce.id}"> ${ce.chancename} </option>
		                  					</c:forEach>
		                  					<option value="suo">所有分类</option>
		              					</select>
	              					</div>
									<div class="controls">
									 	<label>负责人</label>
		              					<select id="select03" name="peid" class="span2">
		                  					<option value="suo">任何人</option>
		                  					<c:forEach items="${employeeList}" var="em" >
		                  						<option  value="${em.id}"> ${em.name} </option>
		                  					</c:forEach>
		              					</select>
	              					</div>
								<label for="">时间
									<select id="select04" name="peid" class="span2">
										<option value="suo">所有时间</option>
										<option value="week">最近一周</option>
										<option value="mouth">最近一个月</option>
										<option value="quarter">最近三个月</option>
										<option value="semester">最近六个月</option>
									</select>
								</label>
							
							</div>
						</div>
					</div>
				</div>
		    </div>
			
			
			<div class="modal fade" id="myModal">
		  <div class="modal-header">
		    <a class="close" data-dismiss="modal">×</a>
			
		    <h3>添加一个任务</h3>
		  </div>
		  <div class="modal-body">
		    <form action="">
				<input type="text" class="span6"/>
				<label for="">到期时间？
					<select name="" id="">
						<option value="">今天</option>
						<option value="">明天</option>
						<option value="">本周</option>
						<option value="">下周</option>
						<option value="">以后</option>
						<option value="">具体时间</option>
					</select>
				</label>
				<label for="">选择一个分类
					<select name="" id="">
						<option value="">无</option>
						<option value="">添加分类</option>
					</select>
					<a href="">编辑分类</a>
				</label>
			</form>
		  </div>
		  <div class="modal-footer">
		    <a href="#" class="btn btn-primary">添加任务</a>
		    <a href="#" class="btn" data-dismiss="modal">取消</a>
		  </div>
		</div>
	</div>
	<script type="text/javascript">
		document.getElementById("select01").onchange = function(){
				if($("#select01").val()=="suo"){
					window.location="chance.jspx";
					//$("#suoyou").text("业务机会"+"→");
				}
				
				if($("#select01").val()=="won"){
					window.location="gen.jspx?state=success";
					$("#suoyou").text("业务机会"+"→"+"状态为成功");
					//$("#span").text("${cha.createtime} ${cha.state }");
					//${cha.state} 
				}
				if($("#select01").val()=="lost"){
					window.location="lost.jspx?state=lost";
					$("#suoyou").text("业务机会"+"→"+"状态为失败");
				}
				if($("#select01").val()=="pending"){
					window.location="pending.jspx?state=pading";
					$("#suoyou").text("业务机会"+"→"+"状态为跟踪");
				}
			
		};
		document.getElementById("select02").onchange = function(){
			if($("#select02").val()=="suo"){
				window.location="chance.jspx";
				$("#suoyou").text("业务机会"+"→");
			}
			<c:forEach items="${chanceItemList}" var="e" >
				if($("#select02").val()=="${e.id}"){
					window.location="type1.jspx?chancename=${e.chancename}&&id=${e.id}";
					$("#suoyou").text("业务机会"+"→"+"分类为${e.chancename}");
				}
			</c:forEach>
		};
		document.getElementById("select03").onchange = function(){
			if($("#select03").val()=="won"){
				window.location="chance.jspx";
				$("#suoyou").text("业务机会"+"→");
			}
			<c:forEach items="${employeeList}" var="a">
				if($("#select03").val()=="${a.id}"){
					window.location="fu.jspx?name=${a.name}&&id1=${a.id}";
					$("#suoyou").text("业务机会"+"→"+"负责人为${a.name}");
				}
			</c:forEach>
		};
		document.getElementById("select04").onchange = function(){
			if($("#select04").val()=="won"){
				window.location="chance.jspx";
				$("#suoyou").text("业务机会"+"→");
			}
			
			if($("#select04").val()=="week"){
				window.location="week.jspx";
				$("#suoyou").text("业务机会"+"→"+"最近一周");
			}
		
			if($("#select04").val()=="mouth"){
				window.location="mouth.jspx";
				$("#suoyou").text("业务机会"+"→"+"最近一月");
			}
			if($("#select04").val()=="quarter"){
				window.location="mouth.jspx";
				$("#suoyou").text("业务机会"+"→"+"最近一季");
			}
			if($("#select04").val()=="semester"){
				window.location="mouth.jspx";
				$("#suoyou").text("业务机会"+"→"+"最近半年");
			}
		
		};
	</script>
</body>
</html>